package com.nifostasky.pattern.consumer;

import com.nifostasky.pattern.config.RabbitFanoutConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 发布订阅模式消费者
 */
@Slf4j
@Component
public class FanoutConsumer {
    /**
     * 消费队列1
     * @param message
     */
    @RabbitListener(queues = {RabbitFanoutConfig.QUEUE_NAME})
    public void process(String message){
        log.info("queue === " + message);
    }

    /**
     * 消费队列2
     * @param message
     */
    @RabbitListener(queues = {RabbitFanoutConfig.QUEUE_NAME_1})
    public void process1(String message){
        log.info("queue1 === " + message);
    }
}
